// import { core, getImage, RenderableBehaviour, propertyEditor_String, SerilizeField, propertyEditor_Number, Transform } from "../gameengine";

// export class AnimationRenderer extends RenderableBehaviour {

//     private image:HTMLImageElement;
//     private images: HTMLImageElement[] = [];
//     private duringTime:number = 0;
//     private currentFrame:number = 0;


//     @SerilizeField(propertyEditor_String)
//     public filepath: string;
//     @SerilizeField(propertyEditor_Number)
//     public config: number;   //动画一共有几张图片  
//     displayObject: any;
//     protected onStart() {
//         this.displayObject.renderNode = this;
//         for (var i: number = 1; i <= this.config; i++) {
//             core.loadImage(this.filepath + i + '.png')
//             this.image = getImage(this.filepath + i + '.png')
//             this.images.push(this.image);
//         }

//     }    
//     protected onUpdate(advancedTime: number) {
//         if (!this.config){
//             return;
//         }
//         this.duringTime += advancedTime;
//         this.currentFrame = (Math.floor(this.duringTime / 16 /4)) % this.config;
//     }
//     onRender(context:CanvasRenderingContext2D){
//         if (this.config){
//             if (this.config) {
//                 const url = this.currentFrame;
//                 this.image = this.images[url];
//                 const transform = this.displayObject.getScript(Transform);
//                 context.drawImage(this.image, 0, 0);
//             }
//         }
//     }
// }